/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author DROWNE
 */
@Entity
@Table(name = "power")
@NamedQueries({
    @NamedQuery(name = "Power.findAll", query = "SELECT p FROM Power p"),
    @NamedQuery(name = "Power.findByIdpower", query = "SELECT p FROM Power p WHERE p.idpower = :idpower"),
    @NamedQuery(name = "Power.findByName", query = "SELECT p FROM Power p WHERE p.name = :name"),
    @NamedQuery(name = "Power.findByDescription", query = "SELECT p FROM Power p WHERE p.description = :description")})
public class Power implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idpower")
    private Integer idpower;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "power")
    private Collection<Canuse> canuseCollection;

    public Power() {
    }

    public Power(Integer idpower) {
        this.idpower = idpower;
    }

    public Power(Integer idpower, String name, String description) {
        this.idpower = idpower;
        this.name = name;
        this.description = description;
    }

    public Integer getIdpower() {
        return idpower;
    }

    public void setIdpower(Integer idpower) {
        this.idpower = idpower;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Collection<Canuse> getCanuseCollection() {
        return canuseCollection;
    }

    public void setCanuseCollection(Collection<Canuse> canuseCollection) {
        this.canuseCollection = canuseCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpower != null ? idpower.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Power)) {
            return false;
        }
        Power other = (Power) object;
        if ((this.idpower == null && other.idpower != null) || (this.idpower != null && !this.idpower.equals(other.idpower))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Power[idpower=" + idpower + "]";
    }

}
